package algorithmTopics.designPatterns.adapterPattern;

/**
 * 媒体适配器
 *
 * @author 86155
 * @date 2025/07/22
 */
public class MediaAdapter implements MediaPlayer {

    AdvanceMediaPlayer advanceMediaPlayer;

    public MediaAdapter(String audioType) {
        if (audioType.equalsIgnoreCase("lvc")) {
            advanceMediaPlayer = new VlcPlayer();
        } else if (audioType.equalsIgnoreCase("mp4")){
            advanceMediaPlayer = new Mp4Player();
        }
    }

    @Override
    public void play(String audioType, String fileName) {
        if (audioType.equalsIgnoreCase("mp4")) {
            advanceMediaPlayer.playMp4(fileName);
        } else if (audioType.equalsIgnoreCase("lvc")) {
            advanceMediaPlayer.playVlc(fileName);
        }
    }
}
